<!--本文件由FirstUI授权予张铖（会员ID： 21 6 8，身份证尾号： 1  2  1996）专用，请尊重知识产权，勿私下传播，违者追究法律责任。-->
<script>
	import {
		AuthApi
	} from './api/login';
	import {
		SystemApi
	} from './api/system';
	import {
		useSyStemStore
	} from './store/modules/system';


	import {
		getViewHeight
	} from './utils/util';
	import {
		useWx
	} from './store/modules/wx';
	import {
		useAuthStore
	} from './store/modules/auth';
	import {
		MainPages
	} from "./config/router-config.js"
	import {
		mapActions,
		mapGetters
	} from 'pinia'
	// TODO 登录交互
	export default {
		data() {
			return {}
		},
		computed: {
			...mapGetters(useAuthStore, ['isLogin'])

		},
		methods: {
			...mapActions(useSyStemStore, ['setDeviceInfo', 'setViewHeight']),


			async init() {
				// 检查是否登录
				if (this.isLogin) {
					uni.navigateTo({
						url: `${MainPages.LOGIN.router}`
					})
				}

			},
			async initUserInfo() {
				// const res = await AuthApi.getUserPhone()
			},


		},
		onLaunch: function(options) {
			console.log('onLaunch', options);
			console.log('onLaunch---app.vue');
			//App2.6.5+ 仅iOS
			// #ifndef APP-PLUS || H5
			if (uni.canIUse('getUpdateManager')) {
				const updateManager = uni.getUpdateManager();
				updateManager.onCheckForUpdate((res) => {
					if (res.hasUpdate) {
						updateManager.onUpdateReady(() => {
							this.fui.modal('更新提示', '发现新版本，为了获得更好的体验，建议立即更新', (res) => {
								updateManager.applyUpdate();
							});
						});
						updateManager.onUpdateFailed(() => {
							this.fui.modal('更新失败', '新版本更新失败，请稍后再试或删除小程序重新搜索打开',
								(res) => {});
						});
					}
				});
			}
			// #endif
			this.setDeviceInfo(uni.getDeviceInfo())




			getViewHeight((h) => {

				this.setViewHeight(h)
			})

		},


		onShow: function() {
			console.log('onShow---app.vue');
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	@import './common/fui-app.css';
	@import './components/firstui/fui-theme/fui-theme.css';
	/*自定义字体css */
	@import './static/icon/fui-custom-icon.css';
	/* 自定义公共样式 */
	@import './common/common.css';
	/**
	 * 自定义图标
	 */
	@import './static/icon/iconfont.css';

	page {
		--fui-color-primary: #0052D9;
		--fui-border-radius-sm: 12rpx;

	}

	uni-page-body,
	html,
	body {
		height: 100%;
	}
</style>